package com.hxd.qzg.module._admin.login;

import org.apache.commons.lang3.StringUtils;

import com.hxd.qzg.common.BaseController;
import com.hxd.qzg.common.Result;
import com.hxd.qzg.common.model.RequestLog;
import com.jfinal.plugin.activerecord.Page;

import cn.hutool.log.Log;
import cn.hutool.log.LogFactory;

public class LogController extends BaseController {

    private static final Log logger = LogFactory.get();


    /**
     * 显示登录界面
     */

	public void list() {
		String start = get("start");

		String end = get("end");

		String fromSql = "FROM request_log WHERE is_delete=0";

		if (StringUtils.isNotEmpty(start)) {
			fromSql = fromSql + " AND create_time >= '" + start + " 00:00:00'";
		}
		if (StringUtils.isNotEmpty(end)) {
			fromSql = fromSql + " AND create_time <= '" + end + " 59:59:59'";
		}
		Page<RequestLog> page = RequestLog.dao.paginate(getInt("pageNum"), getInt("pageSize"), "select *",
				fromSql);
		renderJson(Result.success(page));
    }

}
